package com.gouying.design.patterns.medior;

//塔台
public class Tower {


    private boolean canFly = true;

    public void action(AbstractPlane plane, String action) {
        if (action.equals("fly")) {
            if (canFly) {
                canFly = false;
                System.out.println(plane.getClass().getSimpleName() + " 起飞");
            }else {
                System.out.println(plane.getClass().getSimpleName() + " 飞机太多，不能起飞");
            }
        }
        if (action.equals("flow")) {
            canFly = true;
        }

    }
}
